# coding=utf-8
import csv
import os
import sys
sys.path.append("/..")
from pathlib import Path
from Utils.tool import Tool as tool

class MainCsvProcess():
    @classmethod
    def getCsvContent(cls,path=os.path.join(Path(__file__).parent.parent,"Assets/Main.csv")):
    # def getCsvContent(cls,path=os.path.join(tool.getProjectPath(),"Assets/Main.csv")):    
        contentArray = []
        # main_csv_parent_directory = os.path.abspath(os.path.dirname(__file__))
        main_csv_path = path
        with open(main_csv_path,encoding = "utf-8-sig",mode = "r") as f:
            dictReader = csv.DictReader(f)
            for row in dictReader:
                perLineDic = {}
                perLineDic["TestName"] = row["TestName"]
                perLineDic["Technology"] = row["Technology"]
                perLineDic["Disable"] = row["Disable"]
                perLineDic["Production"] = row["Production"]
                perLineDic["Audit"] = row["Audit"]
                perLineDic["Thread"] = row["Thread"]
                perLineDic["Policy"] = row["Policy"]
                perLineDic["Loop"] = row["Audit"]
                perLineDic["Thread"] = row["Thread"]
                perLineDic["Sample"] = row["Sample"]
                perLineDic["SOF"] = row["SOF"]
                perLineDic["Condition"] = row["Condition"]
                perLineDic["Notes"] = row["Notes"]
                contentArray.append(perLineDic)
        return contentArray
if __name__ == "__main__":
    print(MainCsvProcess.getCsvContent(os.path.join(Path(__file__).parent.parent,"Assets/Main.csv")))

